package com.woniu.user.controller;

import com.woniu.entity.Result;
import com.woniu.user.service.IUserArticleCollectionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户收藏表 前端控制器
 * </p>
 *
 * @author 何荣卓
 * @since 2023-02-17
 */
@RestController
@RequestMapping("/userArticleCollection")
public class UserArticleCollectionController {

    @Autowired
    private IUserArticleCollectionService userArticleCollectionService;

    @ApiOperation("收藏文章")
    @GetMapping("/likeArticle/{userPhone}/{articleId}")
    public Result attentionByUser(@PathVariable("userPhone") String userPhone, @PathVariable("articleId") String articleId){
        return userArticleCollectionService.attentionByUser(userPhone,articleId);
    }

    @ApiOperation("取消收藏文章")
    @GetMapping("/rmlikeArticle/{userPhone}/{articleId}")
    public Result rmLikeArticle(@PathVariable("userPhone") String userPhone, @PathVariable("articleId") String articleId){
        return userArticleCollectionService.rmlikeArticle(userPhone,articleId);
    }

}
